#include <bits/stdc++.h>

using namespace std;
using ll = long long;

void solve() {
	int n;
	cin >> n;
	ll a, b;
	cin >> a >> b;
	vector<vector<int>> g(n + 1);
	for (int i = 0, u, v; i < n - 1; i++) {
		cin >> u >> v;
		g[u].emplace_back(v);
		g[v].emplace_back(u);
	}
	auto bfs = [&](int s) -> vector<int> {
		queue<pair<int, int>> q;
		vector<int> d(n + 1, -1);
		q.emplace(s, 0);
		while (!q.empty()) {
			auto [u, dist] = q.front();
			q.pop();
			if (d[u] != -1) continue;
			d[u] = dist;
			for (auto v : g[u]) {
				if (d[v] != -1) continue;
				q.emplace(v, dist + 1);
			}
		}
		return d;
	};

	auto d1 = bfs(a);
	auto d2 = bfs(b);

	for (int i = 1; i <= n; i++) {
		if (g[i].size() > 1) continue;
		if (d2[i] >= d1[i] * 2) {
			cout << "red" << endl;
			return;
		}
	}
	cout << "purple" << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int t;
	cin >> t;
	while (t-- > 0) solve();
	return 0;
}